CGIDIR = /var/www/cgi-bin
PROGRAM = fiber_guide.cgi
WARNS = fibg_warns.cgi
CXX.SRCS = fiber_guide_cgi.c motor-func.c killbrothers.c img_functions.c quick_median.c v4l2control.c wavecorr.c jpeg_streaming.c CGI_auth.c
WCXX.SRCS = fiforead.c CGI_auth.c 
CC = gcc -O2
COMMONFLAGS = -lsqlite3 -lrt -lcrypt
LDFLAGS = -lm  -lfftw3 -lpthread -lgsl -lgslcblas -lgd
CXX = gcc
CXXFLAGS = -Wall
OBJS = $(CXX.SRCS:.c=.o)
WOBJS = $(WCXX.SRCS:.c=.o)
all : $(PROGRAM) $(WARNS)
$(PROGRAM) : $(OBJS)
	$(CC) $(CXXFLAGS) $(LDFLAGS) $(COMMONFLAGS) $(OBJS) -o $(PROGRAM)
	chmod +s $(PROGRAM)
	cp -fp $(PROGRAM) $(CGIDIR)
$(WARNS): $(WOBJS)
	$(CC)  $(CXXFLAGS) $(WOBJS) $(COMMONFLAGS) -o $(WARNS)
	cp -f fibg_warns.cgi $(CGIDIR)
clean:
	rm -f *.o *~
depend:
	$(CXX) -MM $(CXX.SRCS)

fiber_guide_cgi.o: CGI_auth.h fiber_guide_cgi.h iftest.h img_functions.h jpeg_streaming.h killbrothers.h motor-func.h queues.h quick_median.h signals.h v4l2control.h wavecorr.h 
fiforead.o: CGI_auth.h
img_functions.o: fiber_guide_cgi.h iftest.h img_functions.h
jpeg_streaming.o: fiber_guide_cgi.h iftest.h jpeg_streaming.h
killbrothers.o: killbrothers.h iftest.h
motor-func.o: motor-func.h iftest.h
quick_median.o: quick_median.h iftest.h
v4l2control.o: v4l2control.h iftest.h
wavecorr.o: fiber_guide_cgi.h wavecorr.h iftest.h

